<template>
   <!-- 充值对话框 -->
   <el-dialog :title="title" :visible.sync="visible" :close-on-click-modal="false" width="500px" append-to-body>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="会员卡号" prop="memberNo">
          <el-input v-model="form.memberNo" :disabled="true"/>
        </el-form-item>
        <el-form-item label="姓名" prop="memberName">
          <el-input v-model="form.memberName" :disabled="true" />
        </el-form-item>
        <el-form-item label="手机号码" prop="phone">
          <el-input v-model="form.phone" :disabled="true" />
        </el-form-item>
        <el-form-item label="余额" prop="balanceAmount">
          <el-input v-model="form.balanceAmount" :disabled="true" />
        </el-form-item>
        <el-form-item label="充值金额" prop="amount">
          <el-input-number v-model="form.recordAmount" placeholder="请输入充值金额" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
</template>

<script>
import { addRecord } from "@/api/system/record";
import mixin from '../mixin';
export default {
  mixins: [mixin],
  data() {
    return {
       form: {
            memberId: null,
            memberName: null,
            memberNo: null,
            phone: null,
            balanceAmount: null,
            recordType: "0",
            recordAmount: 0,
            remark: null
       }
    }
  },
  computed: {},
  mounted() {},
  methods: {
    initFormData (row) {
        this.form = {
            ...row,
            balanceAmount: row.memberBalanceAmount
        }
    },
    submitForm () {
        this.$refs.form.validate((valid) => {
            if (valid) {
                addRecord(this.form).then(() => {
                    this.$modal.msgSuccess("充值成功");
                    this.$emit('submit');
                });
            }
        });
    }
  }
}
</script>

